package com.douyang.AspectHandle;


import com.douyang.service.OrderStatementLogService;
import com.douyang.service.SaveLogService;
import com.douyang.service.impl.SaveCreateOrderStatementLogServiceImpl;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class OrderStatementLogAspect {

    @Autowired
    private ApplicationContext applicationContext;

    @Around("@annotation(com.douyang.base.myAnnotation.OrderStatementLog)")
    public Object log(ProceedingJoinPoint joinPoint) throws Throwable {
        String method = joinPoint.getSignature().getName();
        SaveLogService saveLogService = applicationContext.getBean(method, SaveLogService.class);
        return saveLogService.saveLog(joinPoint);
    }
}
